import request, { headers } from '@/utils/request'
import {downloadHandle} from '@/utils'

export default {
  fileInfo(connName,dfsId){return request.get('/fastdfs/fileInfo',{params: {connName,dfsId}})},
  preview(connName,dfsId){
    return request.get('/fastdfs/preview',{params: {connName,dfsId},responseType: 'arraybuffer' })
  },
  download(connName,dfsIds){
    request.get('/fastdfs/download',{params: {connName,dfsIds}, responseType: 'blob'})
      .then(res => {
        downloadHandle(res,{})
      }).catch((error) => {
      console.log(error)
    })
  },
  uploadFiles(formData){return request.post('/fastdfs/uploadFiles',formData)}
}
